#ifndef EIDTITEMDIALOG_H
#define EIDTITEMDIALOG_H

#include <QtGui/QDialog>
#include <QtCore/QStringList>
#include <QtGui/QListWidgetItem>
#include <QtCore/QFile>
#include <QtGui/QMessageBox>
#include <QtCore/QDataStream>

#include "note.h"

//extern NoteItemMap _gItemMap;
namespace Ui {
    class editItemDialog;
}

class editItemDialog : public QDialog
{
    Q_OBJECT

public:
    explicit editItemDialog(QWidget *parent = 0);
    ~editItemDialog();

    enum UI_State{
        NEW,
        EDIT
    };

public Q_SLOTS:
    NoteItemMap * getItemMap();//return all item data
    NoteItemOneDay * getItemOneday(QDate _data);//return specified date's item data
    void setItemOneDay(NoteItemOneDay _item);
    void setItemOneDay(QDate _date);
    void setDate(QDate _date);
    void synchronismData();//synchronism datas from _itemOneDay to _pItemMap

    bool readFromFile(QString fileName="noteData.ldc");
    void saveToFile(QString fileName="noteData.ldc");

    void initUI();
    void setUIenabled(bool flag);
    void updateUI();
    void updateUI(QListWidgetItem * selectedItem);
    void updateUI(NoteItem _item);

Q_SIGNALS:
    void updateDesktop();


private Q_SLOTS:
    void slotSetEnableComboBoxClocker(int);
    void slotSetEnableComboBoxNote(int);
    void slotSetEnableComboBoxTask(int);

    void slotUpdateProgress(int);
    void slotNewItem();
    void slotEditItem();
    void slotDeleteItem();//delete current selected item in ListWidget
    void slotSave();
    void slotClose();

private:
    //QStringList strListClockTime;
    NoteItem        _itemTemp;
    NoteItemOneDay _itemOneDay;
    NoteItemMap * _pItemMap;
    QDate       _curDate_ItemOneDay;
    bool        bNote;
    UI_State    _state;

private:
    Ui::editItemDialog *ui;
};

#endif // EIDTITEMDIALOG_H
